<!--
 * createor: zc
 * email: zc8023zs@163.com
 * create_time: 2020/3/14 13:46:24
 *-->
<template>
  <el-container>
    <el-header>
      关键词详情
    </el-header>
    <el-main>
      <el-form label-width="200px" :inline="true" style="padding:5% 5% 0 5%">
        <el-form-item label="主键：">
          <span>{{formData.id}}</span>
        </el-form-item>
        <el-form-item label="关键词：">
          <span>{{formData.keyword}}</span>
        </el-form-item>
        <el-form-item label="热销：">
          <span>{{formData.is_hot}}</span>
        </el-form-item>
        <el-form-item label="默认：">
          <span>{{formData.is_default}}</span>
        </el-form-item>
        <el-form-item label="显示：">
          <span>{{formData.is_show}}</span>
        </el-form-item>
        <el-form-item label="排序：">
          <span>{{formData.sort_order}}</span>
        </el-form-item>
        <el-form-item label="跳转链接：">
          <span>{{formData.scheme_url}}</span>
        </el-form-item>
        <el-form-item label="类型：">
          <span>{{formData.type}}</span>
        </el-form-item>
      </el-form>
    </el-main>
  </el-container>
</template>
<style scoped>
body .app-container .el-container,
body .app-container .el-header,
body .app-container .el-main,
body .el-container,
body .el-header,
body .el-main {
  padding: 0;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
</style>
<script>
import { Loading } from "element-ui";
import {
  keywordsInfo
} from '@/api/project/simpleshopsetting/project_simpleshopsetting_keywords'
export default {
  name: "a_simpleshopsettinga_keywords_info",
  data() {
    return {
      infoLoading: false,
      formData:{
        id: 0, 
        keyword: '', 
        is_hot: 0, 
        is_default: 0, 
        is_show: 0, 
        sort_order: 0, 
        scheme_url: '', 
        type: 0, 
      }
    };
  },
  activated() {
    var result = location.search.match(new RegExp("[\?\&]id=([^\&]+)", "i"));
    if(result != null || result.length > 0){
      this.onInfo(result[1]);
    }
  },
  methods: {
    onInfo(id){
      this.infoLoading=true;
      keywordsInfo({id:id}).then(r=>{
        this.formData.id = r.dataSingle.id, 
        this.formData.keyword = r.dataSingle.keyword, 
        this.formData.is_hot = r.dataSingle.is_hot, 
        this.formData.is_default = r.dataSingle.is_default, 
        this.formData.is_show = r.dataSingle.is_show, 
        this.formData.sort_order = r.dataSingle.sort_order, 
        this.formData.scheme_url = r.dataSingle.scheme_url, 
        this.formData.type = r.dataSingle.type, 
        this.infoLoading=false;
      }).catch(()=>{
        this.infoLoading=false;
      });
    }
  }
}
</script>
